package Thread;

import java.util.concurrent.*;

public class ThreadPool {

    public static ExecutorService threadPool(int core,int max,int keepAliveTime){
        BlockingQueue<Runnable> workQueue = new LinkedBlockingDeque<>();
        RejectedExecutionHandler rejectedExecutionHandler = new ThreadPoolExecutor.AbortPolicy();
        return new ThreadPoolExecutor(core,max,keepAliveTime, TimeUnit.SECONDS,workQueue,new MyThreadFactory(),rejectedExecutionHandler);
    }


}
